import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { EmailModule } from './email/email.module';
import { PrismaModule } from './prisma/prisma.module';
import { RedisModule } from './redis/redis.module';
import { AuthModule } from './auth/auth.module';
import { JwtModule } from '@nestjs/jwt';
import { APP_GUARD } from '@nestjs/core';
import { AuthGuard } from './gu/auth/auth.guard';
import { PostModule } from './post/post.module';
import { UserModule } from './user/user.module';
import { PermissionGuard } from './gu/permission.guard';
import { FileModule } from './file/file.module';
import { ScheduleModule } from '@nestjs/schedule';
import { TaskModule } from './task/task.module';
import { CommentModule } from './comment/comment.module';

@Module({
  imports: [
    ScheduleModule.forRoot(),
    EmailModule,
    PrismaModule,
    RedisModule,
    AuthModule,
    JwtModule.register({
      secret: '@song',
      signOptions: { expiresIn: '7d' },
      global: true,
    }),
    PostModule,
    UserModule,

    FileModule,

    TaskModule,

    CommentModule,
  ],
  controllers: [AppController],
  providers: [
    AppService,
    { provide: APP_GUARD, useClass: AuthGuard },
    { provide: APP_GUARD, useClass: PermissionGuard },
  ],
})
export class AppModule {}
